#pragma once

template<typename Weight>
class Edge
{
public:
	Edge(int a, int b, Weight w)
	{
		this->a = a;
		this->b = b;
		this->w = w;
	}

	Edge() {}
	~Edge() {}

	int A() { return a; }
	int B() { return b; }
	Weight W() { return w; }

	int other(int x) { return x == a ? b : a; }
	
	friend ostream& operator<<(ostream& os, const Edge& e)
	{
		os << e.a << "-" << e.b << ":" << e.w;
	}

	bool operator<(Edge<Weight>& e)
	{
		return w < e.Weight();
	}

	bool operator<=(Edge<Weight>& e)
	{
		return w <= e.Weight();
	}

	bool operator>(Edge<Weight>& e)
	{
		return w > e.Weight();
	}

	bool operator>=(Edge<Weight>& e)
	{
		return w >= e.Weight();
	}

	bool operator==(Edge<Weight>& e)
	{
		return w == e.Weight();
	}

private:
	int a, b;
	Weight w;
};